﻿using GenUI.WPF.GenControls;
using System;
using System.ComponentModel;

namespace Demo.TestModels
{
    public class PropGridModel : INotifyPropertyChanged
    {
        public void SetTime(DateTime time) => DATETIME = time;

        [PropGridMap("整型")]
        public int INT32 { get; set; } = 32;

        private ENUM eNUM1 = ENUM.Two;
        [PropGridMap("枚举")]
        public ENUM ENUM1
        {
            get { return eNUM1; }
            set
            {
                eNUM1 = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ENUM1"));
            }
        }

        public short INT16 { get; private set; } = 16;
        private float float1;
        [PropGridMap("浮点数")]
        public float Float
        {
            get { return float1; }
            set
            {
                float1 = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Float"));
            }
        }

        public string STRING { get; set; } = "STRING";

        private DateTime timme = DateTime.Now;

        [PropGridMap("时间")]
        public DateTime DATETIME
        {
            get { return timme; }
            private set
            {
                timme = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("DATETIME"));
            }
        }

        private bool bool1;

        [PropGridMap("布尔")]
        public bool BOOL1
        {
            get { return bool1; }
            set
            {
                bool1 = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("BOOL1"));
            }
        }

        public PropGridModel2 PropGridModel2 { get; set; } = new PropGridModel2();
        private bool bool2;

        public bool BOOL2
        {
            get { return bool2; }
            set
            {
                bool2 = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("BOOL2"));
            }
        }

        public enum ENUM
        {
            None = 0,
            One,
            Two
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }
    public class PropGridModel2 : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        public DateTime 时间1 { get; set; } = DateTime.Today;
        private DateTime time2;

        public DateTime 时间2
        {
            get { return time2; }
            set
            {
                time2 = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("时间2"));
            }
        }

        public DateTime 时间3 { get; set; }
        public DateTime 时间4 { get; set; } = DateTime.Today;
        public DateTime 时间5 { get; set; } = DateTime.Today;
        private int myVar;

        public int MyProperty
        {
            get { return myVar; }
            set
            {
                myVar = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("MyProperty"));
            }
        }

    }
}
